package guda.house.biz.form;

import guda.house.biz.util.PriceUtil;
import guda.house.dal.dataobject.ExtraFeeDO;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;


public class ExtraFeeForm {

    @NotNull(message = "不能为空")
    private Long varId;
    @NotNull(message = "不能为空")
    @Pattern(regexp = "^([1-9]\\d*|0)(\\.\\d{1,2})?$",message = "最多2位数的小数")
    private String feeAmount;
    @Size(max=200,message = "最多200个字符")
    private String feeComment;
    @NotNull(message = "不能为空")
    private Long villageId;


    public ExtraFeeDO toDO() {
        ExtraFeeDO extraFeeDO = new ExtraFeeDO();
        extraFeeDO.setVarId(varId);
        extraFeeDO.setFeeAmount(PriceUtil.convertPriceYuan(feeAmount));
        extraFeeDO.setFeeComment(feeComment);
        extraFeeDO.setVillageId(villageId);
        return extraFeeDO;
    }

    public Long getVillageId() {
        return villageId;
    }

    public void setVillageId(Long villageId) {
        this.villageId = villageId;
    }

    public Long getVarId() {
        return varId;
    }

    public void setVarId(Long varId) {
        this.varId = varId;
    }

    public String getFeeAmount() {
        return feeAmount;
    }

    public void setFeeAmount(String feeAmount) {
        this.feeAmount = feeAmount;
    }

    public String getFeeComment() {
        return feeComment;
    }

    public void setFeeComment(String feeComment) {
        this.feeComment = feeComment;
    }
}
